package com.lx.txx.dao;

import com.lx.txx.entity.TxxLease;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.txx.entity.TxxLeaseEx;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 天下行租车-用车表-10 Mapper 接口
 * </p>
 *
 * @author lx
 * @since 2024-12-30
 */
public interface TxxLeaseMapper extends BaseMapper<TxxLease> {

    @Select("SELECT\n" +
            "	b.*,\n" +
            "	a.image,\n" +
            "	a.brand,\n" +
            "	a.model \n" +
            "FROM\n" +
            "	txx_car a,\n" +
            "	txx_lease b \n" +
            "WHERE\n" +
            "	a.id = b.cid \n" +
            "	AND b.uid = #{uid} \n" +
            "	LIMIT #{pageNum},\n" +
            "	#{pageSize};")

    List<TxxLeaseEx> selectLeaseByUid(int uid, int pageSize, int pageNum);


    @Select("SELECT\n" +
            "	count(*) \n" +
            "FROM\n" +
            "	txx_car a,\n" +
            "	txx_lease b \n" +
            "WHERE\n" +
            "	a.id = b.cid \n" +
            "	AND b.uid = #{uid}")

    int countLease(int uid);

}
